package com.huawei.appgallery.wishwall.ui.cardkit.card;

import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.ImageView;
import com.huawei.appgallery.foundation.card.base.card.BaseDistCard;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.appgallery.wishwall.ui.cardkit.bean.WishWallDetailContentCardBean;
import huawei.widget.HwTextView;
import java.util.Arrays;
import java.util.List;
import o.azb;
import o.cgz;
import o.ddq.a;
import o.ddq.d;
import o.eqx;

public class WishWallDetailContentCard extends BaseDistCard {
    private ImageView ʻ;
    private HwTextView ʼ;
    private ImageView ʽ;
    private HwTextView ˊॱ;
    private HwTextView ˋ;
    private HwTextView ˏॱ;
    private List<ImageView> ͺ;
    private ImageView ॱˊ;
    private View ॱॱ;
    private ImageView ᐝ;

    public WishWallDetailContentCard(Context context) {
        super(context);
    }

    public cgz ˏ(View view) {
        azb.ˏ(view, d.ˋॱ);
        this.ˋ = (HwTextView) view.findViewById(d.ʻˊ);
        this.ʼ = (HwTextView) view.findViewById(d.ꞌ);
        this.ʻ = (ImageView) view.findViewById(d.ᐧ);
        this.ʽ = (ImageView) view.findViewById(d.ᐝᐝ);
        this.ᐝ = (ImageView) view.findViewById(d.ᐨ);
        this.ॱˊ = (ImageView) view.findViewById(d.ᐝˊ);
        this.ˊॱ = (HwTextView) view.findViewById(d.ʻˋ);
        this.ˏॱ = (HwTextView) view.findViewById(d.ʼˊ);
        this.ॱॱ = view.findViewById(d.ᐝˋ);
        this.ͺ = Arrays.asList(new ImageView[]{this.ʻ, this.ʽ, this.ᐝ});
        ʽ(view);
        return this;
    }

    public void ˏ(CardBean cardBean) {
        super.ˏ(cardBean);
        if (cardBean instanceof WishWallDetailContentCardBean) {
            WishWallDetailContentCardBean wishWallDetailContentCardBean = (WishWallDetailContentCardBean) cardBean;
            this.ˋ.setText(wishWallDetailContentCardBean.v_());
            if (TextUtils.isEmpty(wishWallDetailContentCardBean.ʽ())) {
                this.ʼ.setVisibility(8);
            } else {
                this.ʼ.setVisibility(0);
                this.ʼ.setText(wishWallDetailContentCardBean.ʽ());
            }
            ॱ(wishWallDetailContentCardBean.ꜟ());
            eqx.ˏ(this.ॱˊ, wishWallDetailContentCardBean.ᶥ(), "head_default_icon");
            this.ˊॱ.setText(wishWallDetailContentCardBean.ㆍ());
            this.ˏॱ.setText(wishWallDetailContentCardBean.ˊ());
        }
    }

    private void ॱ(List<String> list) {
        if (list == null || list.size() <= 0) {
            this.ॱॱ.setVisibility(8);
            return;
        }
        this.ॱॱ.setVisibility(0);
        float f = list.size() == 1 ? 0.5625f : 0.75f;
        int size = list.size() > 3 ? 3 : list.size();
        int ॱ = (azb.ॱ(this.ʼॱ) - ((this.ʼॱ.getResources().getDimensionPixelSize(a.ˊ) * (size - 1)) + (azb.ˊ(this.ʼॱ) + azb.ˏ(this.ʼॱ)))) / size;
        LayoutParams layoutParams = this.ॱॱ.getLayoutParams();
        layoutParams.height = (int) (f * ((float) ॱ));
        this.ॱॱ.setLayoutParams(layoutParams);
        for (int i = 0; i < 3; i++) {
            ImageView imageView = (ImageView) this.ͺ.get(i);
            if (i < size) {
                imageView.setVisibility(0);
                eqx.ˏ(imageView, (String) list.get(i), "image_default_icon");
            } else {
                imageView.setVisibility(8);
            }
        }
    }
}
